#include<bits/stdc++.h>
using namespace std;
const int N=1005,M=5e5+5;
const int f[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
int n,m,B;
int x[M],y[M];
bool fl[N][N];
queue<pair<int,int>> q;
int main(){
    freopen("grid.in","r",stdin);
    freopen("grid.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m>>B;
    for(int i=1;i<=B;++i){
        cin>>x[i]>>y[i];
        if(fl[x[i]][y[i]]==0)q.push({x[i],y[i]});
        fl[x[i]][y[i]]=1;
    }
    while(!q.empty()){
        auto no=q.front();
        q.pop();
        for(int i=0;i<4;++i){
            int tx=no.first+f[i][0],ty=no.second+f[i][1];
            if(tx<1||tx>n)continue;
            if(ty<1||ty>m)continue;
            if(fl[tx][ty])continue;
            int s=0;
            for(int j=0;j<4;++j){
                int ttx=tx+f[j][0],tty=ty+f[j][1];
                if(ttx<1||ttx>n)continue;
                if(tty<1||tty>m)continue;
                s+=fl[ttx][tty];
            }
            if(s>=2){
                q.push({tx,ty});
                fl[tx][ty]=1;
            }
        }
    }
    int ans=0;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            ans+=fl[i][j];
        }
    }
    cout<<ans;
    return 0;
}
